﻿using System;
using DemoService.DataContracts;

namespace DemoService
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "DemoService" in code, svc and config file together.
    public class DemoService : IDemoService
    {
        #region IDemoService Members

        public MyReturnMessageContract MyTestOperation(MyMessageContract input)
        {
            if (string.IsNullOrWhiteSpace(input.MyDataContractInput.TestItem1))
            {
                throw new Exception("TestItem1 should not be empty!");
            }

            var returnMessageContract = new MyReturnMessageContract();

            var output = new MyDataContractOutput
                             {
                                 ResponseItem1 = "TestResult: " + DateTime.Now,
                                 ResponseItem2 = true
                             };
            returnMessageContract.MyDataContractOutput = output;
            return returnMessageContract;
        }

        #endregion
    }
}